import React, { Component } from 'react';
import { NavLink } from "react-router-dom";
import RouterView from '../router/RouterView';
import { Layout, Menu, Breadcrumb, Icon, PageHeader } from 'antd';
const { Content, Sider } = Layout;

class Home extends Component {
    state = {
        collapsed: false,
    };

    onCollapse = collapsed => {
        console.log(collapsed);
        this.setState({ collapsed });
    };
    Navlinks(nas) {
        console.log(nas);
    }
    render() {
        let { child, navlink } = this.props;
        return (
            <Layout style={{ minHeight: '100vh' }}>
                <Sider collapsible collapsed={this.state.collapsed} onCollapse={this.onCollapse}>
                    <div className="logo" />
                    <Menu theme="dark" defaultSelectedKeys={['0']} mode="inline">
                        {
                            navlink && navlink.length > 0 ? navlink.map((item, index) => {
                                return <Menu.Item key={index}>
                                    <NavLink to={item.path}>
                                        <Icon type="desktop" />
                                        <span>{item.name}</span>
                                    </NavLink>
                                </Menu.Item>
                            }) : null
                        }
                    </Menu>
                </Sider>
                <Layout>
                    <PageHeader
                        title="孙1233"
                        style={{
                            border: '1px solid rgb(235, 237, 240)',
                            backgroundColor:"#fff",
                        }}
                        avatar={{ src: 'https://avatars1.githubusercontent.com/u/8186664?s=460&v=4' }}
                    >
                    </PageHeader>
                    <Content style={{ margin: '0 16px' }}>
                        <Breadcrumb style={{ margin: '16px 0' }}>
                            <Breadcrumb.Item>八维管理</Breadcrumb.Item>
                            <Breadcrumb.Item>工作台</Breadcrumb.Item>
                        </Breadcrumb>
                        <div style={{ padding: 24, background: '#fff', minHeight: 360 }}>
                            <RouterView routeList={child} />
                        </div>
                    </Content>
                </Layout>
            </Layout>
        );
    }
}

export default Home;